package com.example.robootttsdemo

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author: tjf
 * @date: 2022-11-07
 * @desc：
 */
class RoBootAdapter(data: MutableList<MultipleRoobItem>) :
    BaseMultiItemQuickAdapter<MultipleRoobItem, BaseViewHolder>(data) {
    init {
        addItemType(MultipleRoobItem.LEFT_ITEM, R.layout.activity_roboot_item_left)
        addItemType(MultipleRoobItem.RIGHT_ITEM, R.layout.activity_roboot_item_right)
    }


    override fun convert(holder: BaseViewHolder, item: MultipleRoobItem) {
        // 根据返回的 type 分别设置数据
        when (holder.itemViewType ) {
            MultipleRoobItem.LEFT_ITEM -> holder.setText(
                R.id.tv_left_msg,
                item.msg
            )
            MultipleRoobItem.RIGHT_ITEM -> holder.setText(
                R.id.tv_right_msg,
                item.msg
            )
        }
    }
}